package com.atguigu.yygh.host.controller;

import com.atguigu.yygh.common.R;
import com.atguigu.yygh.host.service.DepartmentService;
import com.atguigu.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author DongYu Zhou
 * @date 2022/6/27 18:57
 */
@Api(description = "科室接口")
@RestController
@RequestMapping("/admin/hosp/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 根据医院编号查询医院所有的科室列表
     * @param hoscode 医院唯一编号1000_0
     * @return
     */
    @ApiOperation(value = "根据医院编号查询医院所有的科室列表")
    @GetMapping("/getDeptList/{hoscode}")
    public R getDeptList(@PathVariable("hoscode") String hoscode){

        //调用service查询 返回list集合
        List<DepartmentVo> list= departmentService.getDepVoList(hoscode);
        return R.ok().data("list",list);
    }
}
